﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
using Terraria;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;

namespace EAMF.Content.Projectiles
{
    public class Projectile_Star : ModProjectile
    {
        public override string Texture => "EAMF/Images/Projectile_16";
        public override void SetStaticDefaults()
        {
            Main.projFrames[Type] = 1;
            //ProjectileID.Sets.TrailingMode[Type] = 2;
            //ProjectileID.Sets.TrailCacheLength[Type] = 5;
            base.SetStaticDefaults();
        }
        public override void SetDefaults()
        {
            Projectile.width = 2; //设置碰撞体积
            Projectile.height = 2;
            Projectile.alpha = 0;//透明度
            Projectile.timeLeft = 150; //存活时间
            Projectile.penetrate = 1; //穿透次数
            Projectile.friendly = true; //是否是友方弹幕 true表示是
            Projectile.hostile = false; //是否是敌方弹幕 true表示是
            Projectile.tileCollide = true; //是否会创死
            Projectile.ignoreWater = true; //是否穿透水源
            Projectile.netImportant = true; //??
            Projectile.aiStyle = -1;//是否使用原版ai,-1表示使用，默认为-1
            //CooldownSlot = ImmunityCooldownID.Bosses; //使用boss的独立受击无敌时间
            base.SetDefaults();
        }
        public override bool PreDraw(ref Color lightColor)
        {
            Texture2D texture = TextureAssets.Projectile[Type].Value;
            Vector2 xiu = texture.Size() / 2f;
            Rectangle rectangle = new Rectangle(0, 0, texture.Width, texture.Height);
            Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition - xiu, rectangle, lightColor, 0f,new Vector2(0f, 0f) , 1f, SpriteEffects.None, 0);
            return false;
        }
    }
}
